from ..ModelInterface import Model, Widget, Param
from ..node import Node, Link
import time


class IntervalModule(Model):
    def get_title(self):
        return "间隔1s"

    def get_category(self):
        return "时间"

    def get_in(self):
        return []

    def get_out(self):
        return [
            Param("秒", "text"),
        ]

    def get_widget(self):
        return []

    def process(self, node: Node, links: list[Link]) -> list[Link]:
        # 输出毫秒值
        node.outputs[0].value = str(time.time() * 1000)
        return links
